function category() {

    let nav = document.querySelector('#nav')
    let h = document.getElementById('hh')

    console.log(h);
    let hhs = h.children

    ajax({
        url: "http://chst.vip:1234/api/getcategorytitle",
        success(res) {
            res = res.result
            let html = ""
            var num = 0
            res.forEach((item) => {
                html += `
                    <div class="ddv">
                    <a >
                    <span>
                    ${item.title}
                    </span>           
                    <i>
                    ▼
                    </i>           
                    </a>           
                    </div>
                    <div class="dv">
                              
                    </div>
                    `
            })

            hh.innerHTML = html
            console.log(hh.children[0]);
            $(".ddv").on('click', function () {
                $(this).next().toggle();
            })


            for (let i = 0; i < 8; i++) {
                let dvs = document.querySelectorAll('.dv')
                let dvss = [...dvs][num]
                ajax({
                    url: "http://chst.vip:1234/api/getcategory",
                    data: { titleid: num },
                    success(res) {
                        res = res.result
                        // console.log(res);
                        let html2 = ""
                        res.forEach(item => {
                            html2 += `
                                <div><a href="bijia.html?categoryid=${item.categoryId}&title=${item.category}">${item.category}</a></div> 
                                `
                        })
                        dvss.innerHTML = html2
                    }
                })
                num++
            }

        }
    })
}
category()